package main.model.island.grid;

public class GridTree extends GridGrass {
	
	private int TREEMAX = 2000;
	private int tree = TREEMAX;
	
	public GridTree(){
		
	}
	
	public GridTree(int tree){
		this.tree = tree;
		setTree(0);
	}
	
	private void setTree(int treeup){
		tree = tree + treeup;
		if(tree > TREEMAX){tree = TREEMAX;}
		else if(tree < 0){tree = 0;}
	}
	public int getTree(){
		return tree;
	}
	public int getTreeMax(){
		return TREEMAX;
	}
	
	@Override
	public GridType getType(){
		return GridType.TREE;
	}
	@Override
	public int eat(){
		if(tree > 0){
			setTree(-40);
			return 40;
		}
		else{
			return 20;
		}
	}

	@Override
	public int tastyLook(){
		return tree+20;
	}
	@Override
	public void dayPass(){
		setTree(80);
	}
	
	public boolean isAccessible(){return false;}
}
